<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/in.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的会员卡</title>
    <link rel="stylesheet" href="${staticPage}/css/weui.css"/>
    <link rel="stylesheet" href="${staticPage}/css/myVip.css"/>
    <link rel="stylesheet" href="${staticPage}/script/bootstrap/bootstrap-3.3.5-dist/css/bootstrap.min.css"/>
     <link rel="stylesheet" href="${staticPage}/Font-Awesome-3.2.1/css/font-awesome.min.css"/> 
    
     
    <!--<link rel="stylesheet" href="css/example.css"/>-->
</head>
<script type="text/javascript">
$(function(){
	
	function showToast(){
		 $('#toast').show();
       setTimeout(function () {
           $('#toast').hide();
           window.location.reload();
       }, 2000);
	}
	
	$("#info").click(function(){
		location.href="${ctx}/myInfo1.0.do";
	})
	$("#signIn").click(function(){
		/* alert("sadf"); */
		$.getJSON("${ctx}/weixin_signIn.json",function(json){
			if(json.success){
				$("#signIn").html("已签到");
				$("#signIn").removeAttr("onclick");
				$(".weui_btn_primary").css("background-color","#979797");
				showToast();
			}
			else{
				alert(json.msg);
			}
		})
	})
	$.getJSON("${ctx}/user_getUserInfo.json",function(json){
		if(json.success){
			var taday = new Date();
			var signIn=new Date(json.signDate);
			console.log(signIn);
			console.log(json.signDate);
			console.log(taday.getTime());
			$("#headImage").attr("src",json.headImageUrl);
			console.log(json.headImageUrl);
			$("#integration").html(json.points);
			if((taday.getFullYear()==signIn.getFullYear())&&(taday.getMonth()==signIn.getMonth())&&(taday.getDate()==signIn.getDate())){  
				console.log("yiqindao");
				$("#signIn").unbind("click");
				$("#signIn").html("已签到");
				$(".weui_btn_primary").css("background-color","#979797");
			}
			else{
				/*  $("#signIn").removeAttr("disabled");  */
				$("#signIn").html("签到");
				$(".weui_btn_primary").css("background-color","#04BE02"); 
			}

		}
	});
	
	var cssEl = document.createElement('style');
		document.documentElement.firstElementChild.appendChild(cssEl);
		function setPxPerRem() {
		    var dpr=1;
		    var pxPerRem = $(window).width()*dpr/10;
		    cssEl.innerHTML='html{font-size:'+pxPerRem+'px!important;}';

		}
	 
	
});

</script>

<body>
     
   <div class="card">
      <!--<img src="img/vipCard.png">-->
      <div id="avatar">
      <img src="image/icon.png" class="imageAvatar" id="headImage">
      </div>
      
      <div id="idNum">NO:${vipNum}</div>
      <div id="points">积分:<a  id="integration">${point}</a></div>

    </div>
    <div class="weui_cells ">
        <div class="weui_cell" >
            <div class="weui_cell_hd "><span class="icon-signin" style="width:20px;margin-right:4px;display:block;float: left" ></span></div>
            <div class="weui_cell_bd weui_cell_primary">
                <span >&nbsp;&nbsp;&nbsp;签到</span>
            </div>
            <div class="weui_cell_ft" style="font-size: 1.5rem;"><span>点击右侧按钮进行签到 <a class="btn btn-success" id="signIn">签到</a></span></div>
		</div>
    </div>
        <div class="weui_cells weui_cells_access">
        	<a class="weui_cell" href="${staticPage}/myInfo1.0.do" >
	        	<div class="weui_cell_hd"><img src="image/icon-user.png" alt="" style="width:20px;margin-right:5px;display:block;background-color: #f7f7f7"></div>
        <div class="weui_cell_bd weui_cell_primary">
            <p style="color:#444444;margin-bottom: 0px" >&nbsp;&nbsp;&nbsp;我的资料</p>
        </div>
        <div class="weui_cell_ft" style="font-size: 15px;">完善资料，更多惊喜</div>
        	</a>
        </div>

        <div class="weui_cells weui_cells_access">
        	<a class="weui_cell" href="">
             <div class="weui_cell_hd"><i class="icon-money"></i></div>
            <div class="weui_cell_bd weui_cell_primary">
                <p style="color:#444444;margin-bottom: 0px">&nbsp;&nbsp;&nbsp;&nbsp;我的积分</p>
            </div>
            <div class="weui_cell_ft" style="font-size: 15px;">兑换积分</div>
			</a>
        </div> 
    </div>

    <div class="weui_cells row2">

        <div class="weui_cell weui_cells_access">
             <div class="weui_cell_hd"><span src="" class="icon-table" alt="" style="width:20px;margin-right:5px;display:block;float: left "></span></div>
            <div class="weui_cell_bd weui_cell_primary">
                <span>&nbsp;&nbsp;&nbsp;积分兑换记录</span>
            </div>
            <div class="weui_cell_ft"></div>
        </div>
    
 	
        <div class="weui_cell weui_cells_access">
            <div class="weui_cell_hd"><span src="" class="icon-heart" alt="" style="width:20px;margin-right:5px;display:block;color:#ef473a"></span></div>
            <div class="weui_cell_bd weui_cell_primary">
               <span>&nbsp;&nbsp;&nbsp;专属客户经理</span>
            </div>
            <div class="weui_cell_ft"></div>

        </div>
   	</div> 
    <!-- toast -->
	<div id="toast" style="display: none;">
            <div class="weui_mask_transparent"></div>
            <div class="weui_toast">
                <i class="weui_icon_toast"></i>
                <p class="weui_toast_content">签到成功，获得5个积分！</p>
            </div>
    </div>
    

    
    
    
</body>
</html>